<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>reacticity</title>
    <link rel="stylesheet" href="common.css">
    <script type="importmap">
        {
            "imports":{
                "vue":"http://lib.baomitu.com/vue/latest/vue.esm-browser.js"
            }
        }
    </script>
</head>
<body>
    <div id="app">
        <p>
            <button v-on:click="increment">{{count}}</button>
            <button v-on:click="testThis">不要使用箭头函数</button>
        </p>
    </div>
    <script type="module">
        import {createApp} from "vue";
        createApp({
            data() {
                return {
                    count:0
                }
            },
            methods: {
                increment(){
                    console.log(this);
                    this.count++;
                },
                testThis:()=>{
                    console.log(this);
                }
            },
            mounted() {
                console.log(`${this.$data.count}`);
                this.count=2;
            },
        }).mount("#app")
    </script>
</body>
</html>